//
//  PointTemplateSpecial.hpp
//  learnC++
//
//  Created by liuzhibing on 2018/6/21.
//  Copyright © 2018年 yunfan.com. All rights reserved.
//

#ifndef PointTemplateSpecial_hpp
#define PointTemplateSpecial_hpp

#include <stdio.h>
#include <iostream>

template <class T>
class Storage5 {
private:
    T m_value;
    
public:
    Storage5(T value){
        m_value = value;
    }
    
    ~Storage5(){}
    
    void print(){
        std::cout << m_value << "\n";
    }
};

template <typename T>
class Storage5<T*> {
private:
    T *m_value;

public:
    Storage5(T *value){
        //深拷贝指针(这里之拷贝了单个的值)
        m_value = new T(*value);//this copies a single value, not an array

    }

    ~Storage5(){
        delete m_value;
    }

    void print()
    {
        printf("XXX");
        std::cout << *m_value << '\n';
    }

};





#endif /* PointTemplateSpecial_hpp */
